Skip to content

[3.15] gh-146452: Improve locking granularity in pickle's batch_dict_exact and fix race condition (GH-150025)#150039

Merged
JelleZijlstra merged 1 commit into
python:3.15from
miss-islington:backport-57a0e57-3.15
May 18, 2026
Merged

[3.15] gh-146452: Improve locking granularity in pickle's batch_dict_exact and fix race condition (GH-150025)#150039
JelleZijlstra merged 1 commit into
python:3.15from
miss-islington:backport-57a0e57-3.15

Conversation

@miss-islington
Copy link
Copy Markdown
Contributor

@miss-islington miss-islington commented May 18, 2026

Remove assertion that could fail in rare race condition.

Replace the coarse critical section wrapping the entire function with
fine-grained sections covering only PyDict_Next + Py_INCREF.
Also handle PyDict_Next returning 0 in the single-item fast path.
(cherry picked from commit 57a0e57)

Co-authored-by: Saul Cooperman 58375603+scopreon@users.noreply.github.com

…xact and fix race condition (pythonGH-150025)

Remove assertion that could fail in rare race condition.

Replace the coarse critical section wrapping the entire function with
fine-grained sections covering only PyDict_Next + Py_INCREF.
Also handle PyDict_Next returning 0 in the single-item fast path.
(cherry picked from commit 57a0e57)

Co-authored-by: Saul Cooperman <58375603+scopreon@users.noreply.github.com>
@python-cla-bot
Copy link
Copy Markdown

python-cla-bot Bot commented May 18, 2026

All commit authors signed the Contributor License Agreement.

CLA signed

@JelleZijlstra JelleZijlstra enabled auto-merge (squash) May 18, 2026 23:30
@JelleZijlstra JelleZijlstra merged commit 66ade28 into python:3.15 May 18, 2026
56 checks passed
@miss-islington miss-islington deleted the backport-57a0e57-3.15 branch May 18, 2026 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants